package com.dzk.cp.c11x5.index.q3.l012;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.dzk.cp.c11x5.index.BaseC11x5Index;
import com.dzk.cp.c11x5.pojo.R5;
import com.dzk.cp.c11x5.util.SpringBeanUtils;

public class Q3LxxxIndex extends BaseC11x5Index {
	
	protected Q3LxxxIndex setParams(int code, int num, int unit) {
		super.setParams(code, num, unit);
		return this;
	}

	@Override
	public Map<?, Integer> index() {
		Map<Integer, Integer> resultMap = new LinkedHashMap<Integer, Integer>();
		List<? extends R5> r5s = SpringBeanUtils.getR5Service(code).queryLatest(getLastestNum());
		int i = 1;
		for (R5 r5 : r5s) {
			resultMap.put(i++, r5.getN1() % 3 * 9 + r5.getN2() % 3 * 3 + r5.getN3() % 3);
		}
		return resultMap;
	}

	@Override
	protected int getZQ() {
		return 110;
	}
	
	public static Q3LxxxIndex getInstance(int code, int num, int unit) {
		return new Q3LxxxIndex().setParams(code, num, unit);
	}

}
